package cn.lg.FeignClient;

import cn.lg.FeignClient.fallback.UserFeignFallbackFactory;
import cn.lg.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping("/user") //需要注释掉，否则IOC自动帮我们创建代理对象 会冲突
@FeignClient(value = "user-server",fallbackFactory = UserFeignFallbackFactory.class )
public interface UserFeignClient {

    // 和UserController 里的方法名，参数，返回值一模一样
    @GetMapping("/getUserById/{id}")
    public User getUser(@PathVariable("id")Long id);
}